<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SplitContainer Demo</title>
     <style type="text/css">
            @import "../dojo/release4tree/dijit/themes/tundra/tundra.css";
            @import "../dojo/release4tree/dojo/resources/dojo.css";
            @import "../dojo/release4tree/dojox/grid/_grid/tundraGrid.css";
            @import "../dojo/release4tree/dojox/grid/_grid/Grid.css";
            @import "../js/wlProject.css";
			@import "../js/dijitTests.css";
			@import "../dojo/release4tree/dojox/layout/tests/_expando.css";
	
      </style>
      <script type="text/javascript" src="../dojo/release4tree/dojo/dojo.js"  
                djConfig="parseOnLoad: true, isDebug: true,locale: 'zh-cn', extraLocale: ['zh-TW', 'fr']"></script>
      <script>
    
            dojo.require("dojo.data.ItemFileWriteStore");
			dojo.require("dijit.layout.TabContainer");
			dojo.require("dijit.layout.AccordionContainer");
			dojo.require("dijit.layout.BorderContainer");
            dojo.require("dojox.layout.ExpandoPane");
            dojo.require("dijit.layout.ContentPane");
            dojo.require("dijit.Tree");
            dojo.require("dojo.parser");
            dojo.require("dijit._tree.dndSource");
            dojo.require("dijit.layout.TabContainer");
            dojo.require("dijit.form.Button");
            dojo.require("dojox.grid.Grid");
            dojo.require("dojox.grid._data.model");
            dojo.require("dojo.i18n");
            dojo.require("dojox.validate._base");
            dojo.require("dijit.form.ValidationTextBox");
            dojo.require("dijit.form.TextBox");
            dojo.require("dijit.form.FilteringSelect");
            dojo.require("dojox.grid._data.dijitEditors");
            
            dojo.registerModulePath("mydojo", "../../../js/mydojo");
            dojo.require("mydojo.FilteringSelect");
            dojo.require("mydojo.ValidationTextBox");
            
     </script>
        
    <script type="text/javascript" src="../js/soapclient.js"></script>
    <script type="text/javascript" src="../js/wlProject.js"></script>
	<script type="text/javascript" src="../js/peoplevo.js"></script>
	<script type="text/javascript" src="../js/orgavo.js"></script>
	<script type="text/javascript" src="../js/orgaPeoplevo.js"></script>
	<script type="text/javascript" src="../js/peopleRolevo.js"></script>
	<script type="text/javascript" src="../js/rolevo.js"></script>
    <script type="text/javascript" >


        var poptarts3 ={ label:'name',identifier:'eId',items:data};
        var popStore3 = new dojo.data.ItemFileWriteStore({data: poptarts});
		 
        var orderBy3='0';
        //var deletedata2 =new Array();
          //var itemt="区域";
        var selectNodeIdentity3=0;//单击的树节点ID
        var selectNode3;
          
		var griddata3 =  new Array();
		var deletedata3=new Array();
		var querydataRole3 =  new Array();
		var queryvo3=new PeopleVO(); //   
		var totalCount3=0 ;
		var totalpage3=0 ;
		var pagenumber3=1;
		var pagesize3=10;
		var model3 = new dojox.grid.data.Table(null, griddata3);
		var roleTreeModel3 = new dijit.tree.ForestStoreModel({
  				store: popStore3,
  				rootId: "rootRoot3",
  				rootLabel: "系统角色树",
  				childrenAttrs: ["children"]
  			}); 
		  var _roleTree3=dijit.byId("roleTree3");  
		   var pu = new SOAPClientParameters2();
	      pu.add('RoleInfoVO',new RoleInfoVOJs()) ;
	      pu.add('pageNumber',0) ;
	      pu.add('pageSize',0) ;
	      pu.add('orderBy','0') ;
      SOAPClient.invoke(getUrl()+ "services/RoleHandleManageService","getRoleInfo", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           for(var i = 0; i < ul.length-1; i++){		
				  var ulo=ul[i];
				  var newitem=popStore.newItem({name: ulo["ns:roleName"],eId:ulo["ns:id"]}, pInfo);
				}
      }); 
      

		

var addRoleTreeNode3=   function(pid,peopleName,id){
				var pInfo = {
								parent: pid,		
								attribute: "children"	
							};
               popStore.newItem({name: peopleName,eId:"peo"+id}, pInfo);
         }  
var delRoleTreeNode3=	function(id){
		var node = dijit.byId("tree")._itemNodeMap["peo"+id];
		popStore.deleteItem(node.item);//同时删除所有子节点
	  }  
	  
function setRoleTreeNode3(id,peopleName){
		var node = dijit.byId("tree")._itemNodeMap["peo"+id];
		//alert("placeName:"+placeName);
		//alert("placeType:"+placeType);
		popStore.setValue(node.item,"name",peopleName);         
		node.setLabelNode(peopleName);
		 }  
var addRoleRow3 = function(){
          	grid.addRow([false,0,"","","","",""],grid.model.getRowCount());
	        } 
                          
 
        

 function getPeopleRoleVO(queryvo,pagenumber,pagesize,orderBy){
	  var reData=new Array();
      var pu = new SOAPClientParameters2();
      pu.add('PeopleRoleVO',queryvo) ;
      pu.add('pageNumber',pagenumber) ;
	    pu.add('pageSize',pagesize) ;
	    pu.add('orderBy',orderBy) ;
      SOAPClient.invoke(getUrl()+ "services/OrgaPeopleManageService","getPeopleRole", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           reData=PeopleRoleVOtoArray_fun(ul,false);
      }); 
      reData.splice(reData.length-1,1);
	  return reData;
      //model.setData(querydata);
      //dijit.byId("grid").updateRowCount(querydata.length); 
 }  
 var roleOpid=new Array();
 function getRoleVO(queryvo,pagenumber,pagesize,orderBy){
	  var reData=new Array();
      var pu = new SOAPClientParameters2();
      pu.add('RoleInfoVO',queryvo) ;
      pu.add('pageNumber',pagenumber) ;
	    pu.add('pageSize',pagesize) ;
	    pu.add('orderBy',orderBy) ;
      SOAPClient.invoke(getUrl()+ "services/RoleHandleManageService","getRoleInfo", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           reData=RoleInfoVOtoArray_fun(ul,false);
           }); 
      reData.splice(reData.length-1,1);
      return reData;
 }

 

    dojo.connect(_tree, "onClick", function(item,node){
             //判断哪个tab在显示
             	    selectNode=node;
                    selectNodeIdentity = _tree.store.getIdentity(item);
                    //var p0 = new SOAPClientParameters();
			//if(node.item.haveChild=="1"&&node.item.haveChild!="3"){		
              if(node.item.haveChild=="3"){
                    var peopleRolequeryvo=new PeopleRoleVOJs();
                    var peoquervo= new PeopleVO();
					var roleDate=new Array();
					roleOpid=new Array();
					var aOption;
                    peoquervo.id=item["type"];
                    peopleRolequeryvo.people=peoquervo;
                    roleDate=getPeopleRoleVO(peopleRolequeryvo,pagenumber,pagesize,orderBy);
					var selRole=document.getElementById("selectRole");
					/*for(var j=0;j<selRole.length;j++){
						selRole.options[j].selected=false;
					}*/
					selRole.selectedIndex=-1;
					for (var i = 0; i < roleDate.length; i++) {
						var roleOp=RoleInfoVOtoArray_fun(roleDate[i][2],false);
						roleOpid[i]=[roleDate[i][1],roleOp[1]];//[peopleRoleId , roleID]
						for(var j=0;j<selRole.length;j++){
							if(selRole.options[j].value==roleOp[1]){
								selRole.options[j].selected=true;
								j=selRole.length;
							}
					}}
					
                /* var titles=node.item["name"];
                var parentNodes=node;
                while(parentNodes.getParent()!= null&& parentNodes.getParent()["id"]!="tree"){
                      parentNodes=parentNodes.getParent();
                      titles=parentNodes.item["name"]+' '+titles;
                };
                dojo.byId("placetitle").innerHTML = titles +"";*/
             }else if(node.item.haveChild!="3"){
                    //var orgaquervo= new OrgaInfoVOJs();
					
                   /* queryvo.orgaSno=item['type']+"___";
					if(item['type']==undefined)queryvo.orgaSno="___";
                    getOrgaVO(queryvo,pagenumber,pagesize,orderBy);
                    
                grid.selection.clear();
				deletedata =new Array();*/
              }
          });  
           //查询列表----end

            

           

          //查询按钮
          
          

             
</script>
</head>
<body class="tundra">
		<div  dojoType="dijit.layout.BorderContainer" style="height:100%; width:100%;" >
			<div dojoType="dojox.layout.ExpandoPane" splitter="true" duration="125" region="left"   maxWidth="275" style="width: 275px; background: #fafafa;"id="roleTreePane3" title="">
				<div id="roleTree3"  attachParent="true"  showRoot="true" persist="false" dojoType="dijit.Tree"  store="popStore3" labelAttr="name"  childrenAttr="children"  model="roleTreeModel3" ></div>		
			</div>
			<div id="mainTabContainer3" dojoType="dijit.layout.TabContainer" style="">
				<div dojoType="dijit.layout.ContentPane" region="center"  id="rolePane3"  title="角色维护">
					
			    </div>
			</div>
			<div dojoType="dijit.layout.ContentPane" region="center"  id="roleHandePane3"  title="分配角色操作">
			</div>
		</div>
</body></html>
